/*
 * BSM6.0
 *
 * Copyright 2012-2013 (C) SINODATA CO., LTD. All Rights Reserved.
 */
package com.sinodata.bsm.common.vo;

import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;

/**
 * Event entity. @author MyEclipse Persistence Tools
 */
@Entity
@Table(name = "FAULT_TRAP_MSG")
public class FaultTrapMsg implements java.io.Serializable {

    private static final long serialVersionUID = 1L;

    private Long id;
    private Long deviceType;
    private String ip;
    private String version = "";
    private Date recevTime;
    private int secLevel = 1;
    private String secName = "";
    private String enterprise = "";
    private Long requestId = 0L;
    private String errorStatus = "";
    private String errorIndex = "";
    private String genericTrap = "0";
    private String specificTrap = "";
    private String timeStamp = "";
    private String extMsg = "";
    private String msg = "";
    private String msg1 = "";
    private String msg2 = "";
    private String msg3 = "";
    private String msg4 = "";
    private String msg5 = "";
    private String msg6 = "";
    private String msg7 = "";
    private String msg8 = "";
    private String msg9 = "";
    private String msg10 = "";

    public FaultTrapMsg() {

    }

    @Id
    @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "sequence")
    @SequenceGenerator(name = "sequence", sequenceName = "FAULT_TRAP_MSG_SEQ")
    @Column(name = "ID", unique = true, nullable = false, precision = 18, scale = 0)
    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    @Column(name = "device_type", precision = 18, scale = 0)
    public Long getDeviceType() {
        return deviceType;
    }

    public void setDeviceType(Long deviceType) {
        this.deviceType = deviceType;
    }

    @Column(name = "source_ip", length = 32)
    public String getIp() {
        return ip;
    }

    public void setIp(String ip) {
        this.ip = ip;
    }

    @Column(name = "recev_time", length = 7)
    public Date getRecevTime() {
        return recevTime;
    }

    public void setRecevTime(Date recevTime) {
        this.recevTime = recevTime;
    }

    @Column(name = "security_level", precision = 9, scale = 0)
    public int getSecLevel() {
        return secLevel;
    }

    public void setSecLevel(int secLevel) {
        this.secLevel = secLevel;
    }

    @Column(name = "security_name", length = 32)
    public String getSecName() {
        return secName;
    }

    @Column(name = "enterprise", length = 64)
    public String getEnterprise() {
        return enterprise;
    }

    public void setEnterprise(String enterprise) {
        this.enterprise = enterprise;
    }

    public void setSecName(String secName) {
        this.secName = secName;
    }

    @Column(name = "request_id", precision = 18, scale = 0)
    public Long getRequestId() {
        return requestId;
    }

    public void setRequestId(Long requestId) {
        this.requestId = requestId;
    }

    @Column(name = "error_status", length = 32)
    public String getErrorStatus() {
        return errorStatus;
    }

    public void setErrorStatus(String errorStatus) {
        this.errorStatus = errorStatus;
    }

    @Column(name = "error_index", length = 8)
    public String getErrorIndex() {
        return errorIndex;
    }

    public void setErrorIndex(String errorIndex) {
        this.errorIndex = errorIndex;
    }

    @Column(name = "generic_trap", length = 32)
    public String getGenericTrap() {
        return genericTrap;
    }

    public void setGenericTrap(String genericTrap) {
        this.genericTrap = genericTrap;
    }

    @Column(name = "time_stamp", length = 32)
    public String getTimeStamp() {
        return timeStamp;
    }

    public void setTimeStamp(String timeStamp) {
        this.timeStamp = timeStamp;
    }

    @Column(name = "specific_trap", length = 32)
    public String getSpecificTrap() {
        return specificTrap;
    }

    public void setSpecificTrap(String specificTrap) {
        this.specificTrap = specificTrap;
    }

    @Column(name = "ext_msg", length = 64)
    public String getExtMsg() {
        return extMsg;
    }

    public void setExtMsg(String extMsg) {
        this.extMsg = extMsg;
    }

    @Column(name = "msg", length = 2048)
    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }

    @Column(name = "msg_1", length = 512)
    public String getMsg1() {
        return msg1;
    }

    public void setMsg1(String msg1) {
        this.msg1 = msg1;
    }

    @Column(name = "msg_2", length = 512)
    public String getMsg2() {
        return msg2;
    }

    public void setMsg2(String msg2) {
        this.msg2 = msg2;
    }

    @Column(name = "msg_3", length = 512)
    public String getMsg3() {
        return msg3;
    }

    public void setMsg3(String msg3) {
        this.msg3 = msg3;
    }

    @Column(name = "snmp_version", length = 8)
    public String getVersion() {
        return version;
    }

    public void setVersion(String version) {
        this.version = version;
    }

    @Column(name = "msg_4", length = 512)
    public String getMsg4() {
        return msg4;
    }

    public void setMsg4(String msg4) {
        this.msg4 = msg4;
    }

    @Column(name = "msg_5", length = 512)
    public String getMsg5() {
        return msg5;
    }

    public void setMsg5(String msg5) {
        this.msg5 = msg5;
    }

    @Column(name = "msg_6", length = 512)
    public String getMsg6() {
        return msg6;
    }

    public void setMsg6(String msg6) {
        this.msg6 = msg6;
    }

    @Column(name = "msg_7", length = 512)
    public String getMsg7() {
        return msg7;
    }

    public void setMsg7(String msg7) {
        this.msg7 = msg7;
    }

    @Column(name = "msg_8", length = 512)
    public String getMsg8() {
        return msg8;
    }

    public void setMsg8(String msg8) {
        this.msg8 = msg8;
    }

    @Column(name = "msg_9", length = 512)
    public String getMsg9() {
        return msg9;
    }

    public void setMsg9(String msg9) {
        this.msg9 = msg9;
    }

    @Column(name = "msg_10", length = 512)
    public String getMsg10() {
        return msg10;
    }

    public void setMsg10(String msg10) {
        this.msg10 = msg10;
    }

    @Override
    public String toString() {
        return "FaultTrapMsg [id=" + id + ", deviceType=" + deviceType + ", ip=" + ip + ", version=" + version + ", recevTime=" + recevTime + ", secLevel=" + secLevel + ", secName=" + secName + ", enterprise=" + enterprise + ", requestId=" + requestId + ", errorStatus=" + errorStatus + ", errorIndex=" + errorIndex + ", genericTrap=" + genericTrap + ", specificTrap=" + specificTrap + ", timeStamp=" + timeStamp + ", extMsg=" + extMsg + ", msg1=" + msg1 + ", msg2=" + msg2 + ", msg3=" + msg3 + ", msg4=" + msg4 + ", msg5=" + msg5 + ", msg6=" + msg6 + ", msg7=" + msg7 + ", msg8=" + msg8 + ", msg9=" + msg9 + ", msg10=" + msg10 + "]";
    }

    /**
     * 获取Trap消息内容主体
     * @return
     */
    public String toFullMsg() {
        StringBuilder sb = new StringBuilder();
        if (msg1 != null && msg1.length() > 0) {
            sb.append(msg1 + ";");
        }
        if (msg2 != null && msg2.length() > 0) {
            sb.append(msg2 + ";");
        }
        if (msg3 != null && msg3.length() > 0) {
            sb.append(msg3 + ";");
        }
        if (msg4 != null && msg4.length() > 0) {
            sb.append(msg4 + ";");
        }
        if (msg5 != null && msg5.length() > 0) {
            sb.append(msg5 + ";");
        }
        if (msg6 != null && msg6.length() > 0) {
            sb.append(msg6 + ";");
        }
        if (msg7 != null && msg7.length() > 0) {
            sb.append(msg7 + ";");
        }
        if (msg8 != null && msg8.length() > 0) {
            sb.append(msg8 + ";");
        }
        if (msg9 != null && msg9.length() > 0) {
            sb.append(msg9 + ";");
        }
        if (msg10 != null && msg10.length() > 0) {
            sb.append(msg10 + ";");
        }
        return sb.toString();
    }
}
